# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=blosc2
pkgver=2.8.0
pkgrel=1
pkgdesc="A fast, compressed, persistent binary data store library for C."
arch=(loong64 x86_64)
url="https://www.blosc.org"
license=(BSD)
depends=(lz4 zlib zstd)
makedepends=(cmake)
source=(https://github.com/Blosc/c-blosc2/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('586e600513eef16033dc59e1f49bc4eb3fd65017ee9ce0275b42335f29b0cbad96a998b00642a07a4ffd270184cabf1051d810b1b8d6b666489890bed80a4da8')
b2sums=('f2ea37b1178c7934dd37722f96ae156914416678098e4eea6653b435178f588daa631ad7ea553627d4853edbfc28d32293e8ce674efece379af7a8b53fae8aca')

build() {
  cmake -B build -S c-blosc2-$pkgver \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D PREFER_EXTERNAL_LZ4=ON \
    -D PREFER_EXTERNAL_ZLIB=ON \
    -D PREFER_EXTERNAL_ZSTD=ON
  cmake --build build
}

check() {
  ctest --test-dir build --output-on-failure
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -vDm644 c-blosc2-$pkgver/LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
}
